home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / progs / sgi-stereo / fullscreen_stereo.c next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  1.9 KB  |  70 lines

  1.  
  2. /* fullscreen_stereo.c  --  GLUT support for full screen stereo mode  on SGI
  3.    workstations. */
  4.  
  5. /* 24-Oct-95 Mike Blackwell  mkb@cs.cmu.edu */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <X11/Xlib.h>
  10. #include <X11/extensions/SGIStereo.h>
  11.  
  12. /* We need to access some GLUT internal variables - this include file  is
  13.    found in the GLUT source code distribution. */
  14.  
  15. /* XXX I do not normally encourage programs to use GLUT internals.  Programs
  16.    that do (like this one) are inherently unportable GLUT programs.  In the
  17.    case of SGI's low-end stereo there was enough demand to warrant supplying
  18.    an example, and the low-end stereo is not clean enough to be supported
  19.    directly in GLUT. -mjk */
  20.  
  21. #include "glutint.h"
  22.  
  23. #include "fullscreen_stereo.h"
  24.  
  25. /* XXX Video display modes for stereo are selected by running
  26.    /usr/gfx/setmon; in IRIX 6.2 and later releases, the XSGIvc API supplies
  27.    the functionality of setmon and more. */
  28.  
  29. void
  30. start_fullscreen_stereo(void)
  31. {
  32.   int event, error;
  33.  
  34.   if (!XSGIStereoQueryExtension(__glutDisplay, &event, &error)) {
  35.     fprintf(stderr, "Stereo not supported on this display!\n");
  36.     exit(0);
  37.   }
  38.   if (XSGIQueryStereoMode(__glutDisplay, __glutCurrentWindow->win) < 0) {
  39.     fprintf(stderr, "Stereo not supported on this window!\n");
  40.     exit(0);
  41.   }
  42.   if (system("/usr/gfx/setmon -n STR_BOT") != 0) {
  43.     fprintf(stderr, "setmon attempt failed!\n");
  44.     stop_fullscreen_stereo();
  45.     exit(0);
  46.   }
  47. }
  48.  
  49. void
  50. stop_fullscreen_stereo(void)
  51. {
  52.   system("/usr/gfx/setmon -n 72hz");
  53. }
  54.  
  55. void
  56. stereo_left_buffer(void)
  57. {
  58.   XSGISetStereoBuffer(__glutDisplay, __glutCurrentWindow->win, STEREO_BUFFER_LEFT);
  59.   XSync(__glutDisplay, False);
  60.   glViewport(0, 0, XMAXSCREEN, YSTEREO);
  61. }
  62.  
  63. void
  64. stereo_right_buffer(void)
  65. {
  66.   XSGISetStereoBuffer(__glutDisplay, __glutCurrentWindow->win, STEREO_BUFFER_RIGHT);
  67.   XSync(__glutDisplay, False);
  68.   glViewport(0, 0, XMAXSCREEN, YSTEREO);
  69. }
  70.